CC = g++
LIB = -L../lib/unixODBC -L../lib/freeTDS -L../lib -L../lib/mysql
INCLUDE = -I../include/mysql -I../include/unixODBC -I../include/freeTDS -I../base -I../include

CFLAG = -DLINUX -DLOG_LEVEL_LITE -DDEBUG -g -c
#CFLAG = -DLOG_LEVEL_HEAVY -c
#PROFILE = -pg
PROFILE = 
OPTIMIZE =
WARNNING = -w
LINKLIB = -ltiny -lmysqlclient -lodbc -lodbcinst -lmyodbc3 -ltdsodbc -lbaselib_static
TARGET = ../lib/libdb.a
OBJECTS = DBLibs.o DBService.o DBTypeTable.o DBString.o DBQueryQ.o DBError.o DBResultSet.o DBSession.o DBStatement.o MySQL_DBError.o MySQL_DBResultSet.o MySQL_DBStatement.o MySQL_DBSession.o DBSessionManager.o DBSessionProxy.o ODBC_DBError.o ODBC_DBResultSet.o ODBC_DBSession.o ODBC_DBStatement.o 

${TARGET} : ${OBJECTS}
	ar r ${TARGET} ODBC_DBError.o
	ar r ${TARGET} ODBC_DBResultSet.o
	ar r ${TARGET} ODBC_DBSession.o
	ar r ${TARGET} ODBC_DBStatement.o
	ar r ${TARGET} DBLibs.o
	ar r ${TARGET} DBService.o 
	ar r ${TARGET} DBTypeTable.o 
	ar r ${TARGET} DBString.o
	ar r ${TARGET} DBQueryQ.o
	ar r ${TARGET} DBError.o
	ar r ${TARGET} DBResultSet.o
	ar r ${TARGET} DBSession.o
	ar r ${TARGET} DBStatement.o
	ar r ${TARGET} MySQL_DBError.o
	ar r ${TARGET} MySQL_DBResultSet.o
	ar r ${TARGET} MySQL_DBStatement.o
	ar r ${TARGET} MySQL_DBSession.o
	ar r ${TARGET} DBSessionManager.o
	ar r ${TARGET} DBSessionProxy.o
	ar s ${TARGET}
	ar t ${TARGET}

DBLibs.o : DBLibs.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
	
DBService.o : DBService.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
  
DBTypeTable.o : DBTypeTable.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
  
DBString.o : DBString.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

DBQueryQ.o : DBQueryQ.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
	
DBError.o : DBError.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

DBResultSet.o : DBResultSet.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

DBSession.o : DBSession.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

DBStatement.o : DBStatement.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

MySQL_DBError.o : MySQL_DBError.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
	
MySQL_DBResultSet.o : MySQL_DBResultSet.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
	
MySQL_DBStatement.o : MySQL_DBStatement.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
	
MySQL_DBSession.o : MySQL_DBSession.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

DBSessionProxy.o : DBSessionProxy.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
	
DBSessionManager.o : DBSessionManager.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

ODBC_DBError.o : ODBC_DBError.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
  
ODBC_DBResultSet.o : ODBC_DBResultSet.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
  
ODBC_DBSession.o : ODBC_DBSession.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp
  
ODBC_DBStatement.o : ODBC_DBStatement.cpp
	${CC} ${INCLUDE} ${CFLAG} ${PROFILE} ${OPTIMIZE} ${WARNNING} $*.cpp

clean :
	rm -rf *.o *.a

new:
	${MAKE} clean
	${MAKE}
